home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / FreshBar / Demo.rexx next >
Encoding:
OS/2 REXX Batch file  |  1998-05-29  |  7.4 KB  |  328 lines

  1. /* FreshBar-Demoscript */
  2.  
  3. say "FreshBar - Demoskript - ©1998 by Strange Intelligence"
  4. say "written by Christian <City> Taulien."
  5. say "$VER: FreshBar-Demoscript 1.1 (29.05.98)"
  6.  
  7. OPTIONS RESULTS
  8.  
  9. address "FRESHBAR_REXX.1"
  10.  
  11. /**********************/
  12. /* first window       */
  13. /**********************/
  14.  
  15. /* first we create the window */
  16. CREATEBARWINDOW "Demo-Skript"
  17. WinHandle1 = RESULT
  18.  
  19. /* set the width of the window */
  20. SETBARWINDOWWIDTH WinHandle1 200
  21.  
  22. /* then we add a bar to it */
  23. ADDBAR WinHandle1 100
  24. BarHandle1 = RESULT
  25.  
  26. /* set the numeric progressdisplaymode to nothing*/
  27. SETPROGRESSMODE WinHandle1 BarHandle1 0
  28.  
  29. say "A simple bar..."
  30. /* Now open the window */
  31. OPENBARWINDOW WinHandle1
  32.  
  33. /* do something with the bar */
  34. do i=0 to 100
  35.   SETCURRENT WinHandle1 BarHandle1 i
  36.   /* Note, that DELAY is a internal/secret command
  37.   ** of FreshBar and may not be supported in future
  38.   ** its just to get the bars slowlier */
  39.   DELAY 1
  40. end
  41.  
  42. /* Remove the bar and add a new one*/
  43. REMOVEBAR WinHandle1 BarHandle1
  44. say "A simple bar with title ..."
  45. ADDBAR WinHandle1 100 Name "Amiga Marktanteil: "
  46. BarHandle1 = RESULT
  47.  
  48. /* We don't want to see any number display */
  49. SETPROGRESSMODE WinHandle1 BarHandle1 0
  50.  
  51. /* do something with the bar */
  52. do i=10 to 100 by 10
  53.   SETCURRENT WinHandle1 BarHandle1 i
  54.   DELAY 20
  55. end
  56.  
  57. /* We want to see percentage display */
  58. SETPROGRESSMODE WinHandle1 BarHandle1 1
  59.  
  60. say "now with percentage display..."
  61. /* do something with the bar */
  62. do i=10 to 100 by 5
  63.   SETCURRENT WinHandle1 BarHandle1 i
  64.   DELAY 5
  65. end
  66.  
  67. /* We want to see absolute-numbers */
  68. SETPROGRESSMODE WinHandle1 BarHandle1 2
  69.  
  70. say "absolute numbers are also possible..."
  71. /* do something with the bar */
  72. do i=10 to 100 by 5
  73.   SETCURRENT WinHandle1 BarHandle1 i
  74.   DELAY 5
  75. end
  76.  
  77. /* delete the window */
  78. DELETEBARWINDOW WinHandle1
  79.  
  80.  
  81. /**********************/
  82. /* second window      */
  83. /**********************/
  84.  
  85. /* first we create the window */
  86. CREATEBARWINDOW "<--CloseGadget_optional" CLOSEGADGET
  87. WinHandle1 = RESULT
  88.  
  89. /* set the width of the window */
  90. SETBARWINDOWWIDTH WinHandle1 200
  91.  
  92. /* Add a new bar */
  93. ADDBAR WinHandle1 100 NAME "PC Marktanteil: "
  94. BarHandle1 = RESULT
  95.  
  96. /* We want to see percentage display */
  97. SETPROGRESSMODE WinHandle1 BarHandle1 1
  98.  
  99. say "Optional CloseGadget..."
  100.  
  101. /* Now open the window */
  102. OPENBARWINDOW WinHandle1
  103.  
  104. /* do something with the bar */
  105. do i=100 to 0 by -1
  106.   SETCURRENT WinHandle1 BarHandle1 i
  107.   DELAY 1
  108. end
  109.  
  110. /* delete the window */
  111. DELETEBARWINDOW WinHandle1
  112.  
  113.  
  114. /**********************/
  115. /* third window       */
  116. /**********************/
  117.  
  118. /* first we create the window */
  119. CREATEBARWINDOW "Optional_OK-Button" "_Fritz!" CLOSEGADGET
  120. WinHandle1 = RESULT
  121.  
  122. /* set the width of the window */
  123. SETBARWINDOWWIDTH WinHandle1 200
  124.  
  125. /* add a new bar */
  126. ADDBAR WinHandle1 100 Name "PC Marktanteil: "
  127. BarHandle1 = RESULT
  128.  
  129. /* We want to see percentage display */
  130. SETPROGRESSMODE WinHandle1 BarHandle1 1
  131.  
  132. say "Optional button..."
  133. /* Now open the window */
  134. OPENBARWINDOW WinHandle1
  135.  
  136. /* do something with the bar */
  137. do i=100 to 0 by -1
  138.   SETCURRENT WinHandle1 BarHandle1 i
  139.   DELAY 1
  140. end
  141.  
  142. /* delete the window */
  143. DELETEBARWINDOW WinHandle1
  144.  
  145.  
  146. /**********************/
  147. /* fourth window      */
  148. /**********************/
  149.  
  150. /* first we create the window */
  151. CREATEBARWINDOW "Colors_are_possible" "_Cool!" CLOSEGADGET
  152. WinHandle1 = RESULT
  153.  
  154. /* set the width of the window */
  155. SETBARWINDOWWIDTH WinHandle1 200
  156.  
  157. /* adding a bar */
  158. ADDBAR WinHandle1 100 Name "PC Marktanteil: "
  159. BarHandle1 = RESULT
  160.  
  161. /* We want to see percentage display */
  162. SETPROGRESSMODE WinHandle1 BarHandle1 1
  163.  
  164. /* Play with colors */
  165. SETFILLPEN WinHandle1 BarHandle1 12
  166. SETBACKPEN WinHandle1 BarHandle1 11
  167.  
  168. say "Colours make the world more beautiful..."
  169. /* Now open the window */
  170. OPENBARWINDOW WinHandle1
  171.  
  172. /* do something with the bar */
  173. do i=100 to 0 by -1
  174.   SETCURRENT WinHandle1 BarHandle1 i
  175.   DELAY 1
  176.   if i<50 then
  177.   do
  178.     SETFILLPEN WinHandle1 BarHandle1 i
  179.     SETBACKPEN WinHandle1 BarHandle1 50-i
  180.   end
  181. end
  182.  
  183. /* Play with colors */
  184. SETFILLPEN WinHandle1 BarHandle1 8
  185. SETBACKPEN WinHandle1 BarHandle1 11
  186.  
  187. say "Resizing ist possible..."
  188. /* do something with the bar */
  189. do i=100 to 0 by -10
  190.   SETCURRENT WinHandle1 BarHandle1 i
  191.   SETBARWINDOWWIDTH WinHandle1 200+i
  192.   DELAY 20
  193. end
  194.  
  195. /* show the feature of resizing the window */
  196. SETBARWINDOWWIDTH WinHandle1 400
  197. DELAY 30
  198. SETBARWINDOWWIDTH WinHandle1 180
  199. DELAY 30
  200. SETBARWINDOWWIDTH WinHandle1 300
  201. DELAY 30
  202. SETBARWINDOWWIDTH WinHandle1 200
  203. DELAY 30
  204.  
  205. say "But size isn't everything..."
  206. /* do something with the bar */
  207. do i=100 to 0 by -10
  208.   SETCURRENT WinHandle1 BarHandle1 i
  209.   SETBARWINDOWPOS WinHandle1 10+i*3 10+i*2
  210.   DELAY 10
  211. end
  212.  
  213. say "Center position..."
  214. /* reset the window's position */
  215. SETBARWINDOWPOS WinHandle1 X "-1" Y "-1"
  216.  
  217. DELAY 30
  218.  
  219. say "Multiple bars are no problem..."
  220. /* add a bar and configure it */
  221. ADDBAR WinHandle1 1500 Name "Amiga Marktanteil: "
  222. BarHandle2 = RESULT
  223. SETFILLPEN WinHandle1 BarHandle2 9
  224. SETBACKPEN WinHandle1 BarHandle2 6
  225. SETPROGRESSMODE WinHandle1 BarHandle2 0
  226.  
  227. /* add a bar and configure it */
  228. ADDBAR WinHandle1 2100 Name "Apple Marktanteil: "
  229. BarHandle3 = RESULT
  230. SETFILLPEN WinHandle1 BarHandle3 13
  231. SETBACKPEN WinHandle1 BarHandle3 4
  232. SETPROGRESSMODE WinHandle1 BarHandle3 2
  233.  
  234. /* slide the bars */
  235. do i=100 to 0 by -1
  236.   SETCURRENT WinHandle1 BarHandle1 i
  237.   SETCURRENT WinHandle1 BarHandle2 VALUE 1500-i*10
  238.   SETCURRENT WinHandle1 BarHandle3 VALUE i*21
  239. end
  240.  
  241. /* add a bar and configure it */
  242. ADDBAR WinHandle1 500 Name "Archimedes Marktanteil: "
  243. BarHandle3 = RESULT
  244. SETFILLPEN WinHandle1 BarHandle3 0
  245. SETBACKPEN WinHandle1 BarHandle3 3
  246. SETPROGRESSMODE WinHandle1 BarHandle3 1
  247.  
  248. say "You can test the buttonstate for canceling actions..."
  249. say "Press the Button!"
  250.  
  251. /* do something with the bars */
  252. do i=0 to 100 by 1
  253.   SETCURRENT WinHandle1 BarHandle1 100-i
  254.   SETCURRENT WinHandle1 BarHandle2 i*10
  255.   SETCURRENT WinHandle1 BarHandle3 100-i
  256.   DELAY 1
  257.  
  258.   /* test the button state */
  259.   TESTOKBUTTON WinHandle1
  260.   if RESULT == 1 then leave
  261. end
  262.  
  263. /* evaluate the users behavior */
  264. if (i<100) then
  265.   say "Stopped at " i
  266. else
  267.   say "You didn't press the button!"
  268.  
  269.  
  270.  
  271. /*****************************************************/
  272. /* Now we create a second window at the same time    */
  273. /* to show the feature of creating unlimited numbers */
  274. /* of windows containing an unlimited number of bars */
  275. /* in turn.                                          */
  276. /*****************************************************/
  277.  
  278. /* Create the window */
  279. CREATEBARWINDOW "Multiple_Windows" "_CITY!" CLOSEGADGET
  280. WinHandle2 = RESULT
  281.  
  282. /* adding several bars  */
  283. ADDBAR WinHandle2 1500 Name "Desitination: "
  284. BarHandle1 = RESULT
  285. ADDBAR WinHandle2 2100 Name "Source: "
  286. BarHandle2 = RESULT
  287.  
  288. /* configure bar #1 */
  289. SETFILLPEN WinHandle2 BarHandle1 9
  290. SETBACKPEN WinHandle2 BarHandle1 6
  291. SETPROGRESSMODE WinHandle2 BarHandle1 0
  292.  
  293. /* configure bar #2 */
  294. SETFILLPEN WinHandle2 BarHandle1 13
  295. SETBACKPEN WinHandle2 BarHandle1 4
  296. SETPROGRESSMODE WinHandle2 BarHandle2 2
  297.  
  298. /* make sure not to cover the other window */
  299. SETBARWINDOWPOS WinHandle1 X 20 Y 20
  300.  
  301. say "And finally multiple windows are no problem too..."
  302. /* present our work on screen */
  303. OPENBARWINDOW WinHandle2
  304.  
  305. /* now lets dance */
  306. do i=0 to 100 by 1
  307.   /* update the values from the 1st window */
  308.   SETCURRENT WinHandle1 BarHandle1 100-i
  309.   SETCURRENT WinHandle1 BarHandle2 i*10
  310.   SETCURRENT WinHandle1 BarHandle3 100-i
  311.  
  312.   /* update the 2nd window's bars */
  313.   SETCURRENT WinHandle2 BarHandle1 i*5
  314.   SETCURRENT WinHandle2 BarHandle2 i*10
  315.   DELAY 1
  316. end
  317.  
  318. About
  319.  
  320. /* delete the windows */
  321. DELETEBARWINDOW WinHandle2
  322. DELETEBARWINDOW WinHandle1
  323.  
  324. say "FreshBar is great, isn't it?!"
  325.  
  326. Quit
  327.  
  328.